import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: qian
 * Date: 2022-08-06
 * Time: 14:52
 */
class Student implements Comparable<Student> {
    private String name;
    private int age;
    private double score;

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public double getScore() {
        return score;
    }

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public int compareTo(Student o) {
        return this.age - o.getAge();
    }
}
class Alg<T extends Comparable<T>>{
    public T findMax(T[] arr) {
        T max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(max.compareTo(arr[i]) < 0) {
                max = arr[i];
            }
        }
        return max;
    }


}
class Test {
    public static void main(String[] args) {
        System.out.println('-');
    }
    public static int[] OnceOfArray(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            int tmp = 0;
            for (int j = 0; j < arr.length; j++) {
                if (arr[i] == arr[j]) {
                    tmp++;
                }
            }
            if (tmp == 1) {
                System.out.println(arr[i]);
            }
        }
        return null;
    }

    public static void main18(String[] args) {
        int[] arr={2,3,3,7,2};
        OnceOfArray(arr);
        System.out.println();

    }
    public static void main17(String[] args) {
        int[] arr = {1,2,34,3,4,23,12};
        boolean ret = threeConsecutiveOdds(arr);
        System.out.println(ret);
    }
    public static boolean threeConsecutiveOdds(int[] arr) {
        int i = 0;
        for(i = 0;i < arr.length - 2 ;i++ ){
            if(func(arr[i],arr[i+1],arr[i+2])){
                return true;
            }
        }
        if(i == (arr.length - 2)){
            return false;
        }
        return false;
    }
    public static boolean func(int a ,int b,int c){
        int[] arr = {a , b ,c};
        for(int i = 0;i < arr.length;i++){
            if(arr[i] % 2 == 0){
                return false;
            }else{
                arr[i] = -1;
            }
        }
        if(a == b && b == c && c == -1){
            return true;
        }
        return true;
    }

    public int missingNumber(int[] nums) {
        boolean flg=true;
        Set<Integer> set=new HashSet<>();
        int n=nums.length;
        for (int i=0;i<n;i++){
            set.add(nums[i]);
        }
        int missing=-1;
        for(int i=0;i<=n;i++){
            if(!set.contains(i)){
                missing=i;
                break;
            }
        }
        return missing;
    }
    public static void main16(String[] args) {
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值 。
        int flg=1;
        double sum=0;
        for(int i=1;i<=100;i++){
            sum+=flg*1.0/i;
            flg*=-1;
        }
        System.out.println(sum);
    }
    public static void oddSort(int []array){
        int left=0;
        int right=array.length-1;
        while(right>left){
            while(array[left]%2==1 && left<=right){
                left++;
            }
            while(array[right]%2==0 && left<=right){
                right--;
            }
            if(right >left){
                int tmp=array[left];
                array[left]=array[right];
                array[right]=tmp;
                right--;
                left++;
            }
        }
    }
    public static int findMost(int []array) {
//找出数组中出现了几个数
        int[] array2 = new int[array.length / 2];
        int i = 0;//array2中数据个数的计数器
        for (int j = 0; j < array.length; j++) {
            boolean fla = false;
            for (int k = 0; k < i; k++) {
                if (array[j] == array[k]) {
                    fla = true;
                }
            }
            if (fla == false) {

                array2[i] = array[j];
                i++;
            }
        }
//找出每个数出现的次数，判断是否大于n/2
        for (int j = 0; j < i; j++) {
            int count = 0;
            for (int k = 0; k < array.length; k++) {
                if (array[k] == array2[j]) {
                    count++;
                }
            }
            if (count > array.length / 2) {
                return array2[j];
            }

        }
        return 0;//没有找到就返回0
    }
    public static void main15(String[] args) {
        int[] arr={1,2,3,2,1,1,1,1,1,1};
        System.out.println(findMost(arr));
    }
    public static int[] findKey(int[] arr, int target){
        int i=0;
        int j=arr.length-1;
        while (i<j){
            if(arr[i]+arr[j]<target){
                i++;
            }else if(arr[i]+arr[j]>target){
                j--;
            }else{
                return new int[]{i,j};
            }
        }
        return new int[]{-1,-1};
    }
    public static void main14(String[] args) {
        int[] arr={1,2,3,4,5,6};
        int target=10;
        System.out.println(Arrays.toString(findKey(arr, target)));
    }
    public static float avg(int[] arr,int len) {
        int sum = 0;
        for (int i = 0; i < len; i++) {
            sum = sum + arr[i];
        }
        return sum/len;
    }

    public static void main13(String[] args) {
        int[] arr1 = {1,2,3,7};
        int len = arr1.length;

        float avg1 = avg(arr1,len);
        System.out.println(avg1);
    }
    public static boolean search_contiThereImpari(int[] array){
        for(int i = 0; i < array.length-3; i++){
            if((array[i]%2==1) && (array[i+1]%2==1) && (array[i+2]==1)){
                return true;
            }
        }
        return false;
    }

    public static void main12(String[] args) {
        int[] arr={2,4,5,7,9};
        System.out.println(search_contiThereImpari(arr));
    }
    public static int search_Only(int[] array){
        int ret = array[0];
        for(int i = 0; i < array.length - 1; i++){
            ret = ret ^ array[i+1];
        }
        return ret;
    }

    public static void main11(String[] args) {
        int[] arr={1,2,2};
        System.out.println(search_Only(arr));
    }
    public static void pari_Array(int[] array){
        for(int i = 0; i < array.length-1; i++){
            for(int j = 0;j < array.length- i- 1; j++){
                if(array[j] % 2 ==0){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
    }

    public static void main10(String[] args) {
        int[] arr={1,2,3,4,5,6};
        pari_Array(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void main9(String[] args) {
        boolean flg=false;
        int n=4;
        for(int i=2;i<n;i++){
            if(n%i==0){
                flg=true;
            }
        }
        if(!flg){
            System.out.println("是素数");
        }else{
            System.out.println("不是素数");
        }
    }
    public static boolean threeOdd(int[]arr){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]%2!=0) {
                if ((arr[i + 1] % 2 != 0) && (arr[i + 2] % 2 != 0)) {
                    return true;
                }
            }
        }
        return false;
    }
    public static int fiboNonRecursion(int n){
        int last2 = 1;
        int last1 = 1;
        int cur = 0;
        for (int i = 3; i <= n; i++) {
            cur = last1 + last2;
            last2 = last1;
            last1 = cur;
        }
        return cur;
    }
    public static void main8(String[] args) {
        String s1=new String("hello");
        s1=s1.intern();
        String s2="hello";

        System.out.println(s1==s2);
    }
    public static void main7(String[] args) {
        ArrayList<Stack<Integer>> list=new ArrayList<>();
        Stack<Integer> stack=new Stack<>();
    }
    public static void main6(String[] args) {
        int[] arr={1,4,2,5,3};
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static boolean isPrime(int n){
        int i=2;
        for(;i<=Math.sqrt(n);i++){
            if(n%i==0){
                break;
            }
        }
        if(n!=1 && i>Math.sqrt(n)){
            return true;
        }
        return false;
    }
    public static int reverseNum(int n){
        int val=0;
        while(n!=0){
            val=val*10+n%10;
            n/=10;
        }
        return val;
    }
    public static void main5(String[] args){
        Scanner sc=new Scanner(System.in);
        int prime=8120;
        int i=1;
        while(prime!=0){
            int revI=reverseNum(i);
            if(i!=revI && isPrime(i) && isPrime(revI)){
                prime--;
            }
            i++;
        }
        if((i-1)<=Math.pow(10,6)){
            System.out.println(i-1);
        }else{
            System.out.println(-1);
        }

    }

    public static void main4(String[] args) {
        for (int i = 2; i < 101; i++) {
            for (int j = 2; j < i; j++) {
                if (i % j != 0) {
                    break;
                }
                if (j == i) {
                    System.out.println(i);

                }
            }
        }
    }

    public static int find(int[] arr, int x){
        int left = 0;
        int right = arr.length-1;
        while(left <= right){
            int mid = (left + right)/2;
            if(arr[mid] > x){
                right = mid;
            }
            if(arr[mid] < x){
                left = mid;
            }
            if(arr[mid] == x){
                return mid;
            }
        }
        return -1;
    }
    public static void main3(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int n = 1;
        int ret = find(arr,n);
        if(ret < 0){
            System.out.println("没找到");
        }
        else {
            System.out.println("下标是 " + ret);
        }
    }
    public static void main2(String[] args) {
        HashMap<String,Integer> map=new HashMap<>();
    }
    public static String simplifyPath(String path) {
        StringBuilder pa=new StringBuilder();
        Stack<String> stack=new Stack<>();
        int i=0;
        while(i<path.length()){
            StringBuilder ss=new StringBuilder();
            if(ss.toString().equals("")){
                ss.append(path.charAt(i));
                i++;
            }
            while(i<path.length() && path.charAt(i)=='/'){
                i++;
            }
            while(i<path.length() && path.charAt(i)!='/'){
                ss.append(path.charAt(i));
                i++;
            }
            if(!stack.empty() && ss.equals("/..")){
                stack.pop();
            }else if(ss.equals("/.")){
                continue;
            }else{
                stack.push(ss.reverse().toString());
            }

        }
        if(!stack.empty() && stack.peek().equals("/")){
            stack.pop();
        }
        while(!stack.empty()){
            pa.append(stack.pop());
        }
        return pa.reverse().toString();
    }

    public static void main1(String[] args) {
        String pa="/a/./b/../../c/";
        System.out.println(simplifyPath(pa));
    }
    public int data1 = 1;
    int data2 = 2;
    public static int data3 = 3;

    public void test() {
        System.out.println("out::test()");
    }

    /**
     * 1. 如何获取静态内部类对象？
     *          OuterClass2.InnerClass2 innerClass2 = new OuterClass2.InnerClass2();
     * 2. 静态内部类当中，不能访问外部类的非静态成员。外部类的非静态成员，
     *          需要通过外部类的对象的引用才能访问。
     *     非要访问： OuterClass2 outerClass = new OuterClass2();
     *             System.out.println(outerClass.data1);
     */
    static class InnerClass2 {
        public int data4 = 4;
        int data5 = 5;
        public static int data6 = 6;

        public void func() {
            System.out.println("out::func()");

            Test outerClass = new Test();
            System.out.println(outerClass.data1);

            /*System.out.println(data1);
            System.out.println(data2);*/

            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data5);
            System.out.println(data6);
        }
    }

}
